<script>
	import { sqlName, sqlPath, openDb, isOpened, closeDb, selectSql, executeSql } from "./static/sql/sqllite.js"
	import { meida_plans_table } from "./static/sql/tables.js"

	export default {
		onLaunch: function() {
			console.log('App Launch')
			setTimeout(() => {
				plus.screen.lockOrientation("landscape");
			}, 500);
			this.globalData = {
				redirected: false
			};
			this.openSql()//开启数据库

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods:{
		  openSql(){//开启数据库
			let type = isOpened(sqlName, sqlPath)//判断是否开启了数据库
			console.log(type,"typeeeeeeeeeeeeeeeeeeeeeeeeee")
				if (!type) {
					openDb(sqlName, sqlPath).then(res => {//没有开启就去开启数据库
						
						meida_plans_table()//开启数据库后，创建数据库表结构
					})
				}
			},
		}



	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import 'uview-ui/index.scss';
	.container {
		
		display: flex !important;
		flex-direction: column !important;
		align-items: center !important;
		justify-content: center !important;
		height: 100% !important;
	}
	
	.timer {
		font-size: 32px;
		margin-bottom: 10px;
	}
	
	.slider {
		justify-content: space-between;
	}
	
	.slider-container {
		display: flex;
		/* 水平居中对齐 */
		align-items: center;
	}
	
	.top {
		display: flex;
		justify-content: space-around;
		align-items: center;
		margin: 40px 0 0 0;
		padding: 0 40px;
	}
	
.top-btn {
    width: 100px;
    padding: 8px 16px;
    text-align: center;
    font-size: 14px;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
	
.top-image {
    width: 80px;
    height: 80px;
    cursor: pointer;
}
	
	.custom-style {
		width: 180px;
		height: 50px;
		font-size: 25px;
		color: black;
		border: 1px black solid;
	}
</style>